function btnAdd() {
    location.href = "./addOrUpd.html"
}

async function addSave() {
    console.log("保存");
    let id = new URLSearchParams(window.location.search).get('id') || 0
    console.log(id);
    let teacherName=$(`[name="teacherName"]`).val()
    let teacherAge=$(`[name="teacherAge"]`).val()
    let res
    if (id) {
        res=await axios.put(`http://localhost:5000/teacher/${id}`,{teacherName,teacherAge})
    }else{
        res=await axios.post(`http://localhost:5000/teacher`,{teacherName,teacherAge})
    }
    console.log(res.data.code);
    if (res.data.code===1000) {
        location.href="./index.html"
    }else{
        confirm("请重试")
    }

}
function addCancel() {
    location.href = "./index.html"
}